package com.slz3.business.module.goodsManagement.baseGoods.steward;

import com.slz3.business.module.goodsManagement.baseGoods.domain.BaseGoods;
import com.slz3.business.module.goodsManagement.baseGoods.domain.BaseGoodsCondition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;

@Component
public class BaseGoodsResponse {

    @Autowired
    private BaseGoodsResController baseGoodsResController;

    public  Mono<ServerResponse> add(ServerRequest req) {
        return req.bodyToMono(BaseGoods.class).flatMap(baseGoods ->
                baseGoodsResController.add(req, baseGoods)
        );
    }

    public  Mono<ServerResponse> delete(ServerRequest req) {
        return req.bodyToMono(BaseGoodsCondition.class).flatMap(baseGoodsCondition ->
                baseGoodsResController.delete(req, baseGoodsCondition)
        );
    }

    public  Mono<ServerResponse> modify(ServerRequest req) {
        return req.bodyToMono(BaseGoods.class).flatMap(baseGoods ->
                baseGoodsResController.modify(req, baseGoods)
        );
    }


    public  Mono<ServerResponse> list(ServerRequest req) {
        return baseGoodsResController.list(req);
    }

    public  Mono<ServerResponse> info(ServerRequest req) {
        return baseGoodsResController.info(req);
    }

    public  Mono<ServerResponse> choice(ServerRequest req) {
        return baseGoodsResController.choice(req);
    }

    public  Mono<ServerResponse> auditSubmit(ServerRequest req) {
        return req.bodyToMono(BaseGoodsCondition.class).flatMap(baseGoodsCondition ->
                baseGoodsResController.auditSubmit(req, baseGoodsCondition)
        );
    }

    public  Mono<ServerResponse> audit(ServerRequest req) {
        return req.bodyToMono(BaseGoodsCondition.class).flatMap(baseGoodsCondition ->
                baseGoodsResController.audit(req, baseGoodsCondition)
        );
    }

    public  Mono<ServerResponse> auditReject(ServerRequest req) {
        return req.bodyToMono(BaseGoodsCondition.class).flatMap(baseGoodsCondition ->
                baseGoodsResController.auditReject(req, baseGoodsCondition)
        );
    }

    public  Mono<ServerResponse> usingEnable(ServerRequest req) {
        return req.bodyToMono(BaseGoodsCondition.class).flatMap(baseGoodsCondition ->
                baseGoodsResController.usingEnable(req, baseGoodsCondition)
        );
    }

    public  Mono<ServerResponse> usingDisable(ServerRequest req) {
        return req.bodyToMono(BaseGoodsCondition.class).flatMap(baseGoodsCondition ->
                baseGoodsResController.usingDisable(req, baseGoodsCondition)
        );
    }   

}
